﻿<!--#include file="../Include/Config.asp"-->
<link rel="stylesheet" href="../Css/Admin.css" type="text/css" />
<%
dim sql,action,Admin_id
action=request.QueryString("Action")
Admin_id=request.QueryString("Admin_id")
select case action'分析动作，执行各种操作后再加载页面
   case "audi"
   call CheckNum(Admin_id)
   sql="update Admins set Admin_state=1 where Admin_id="&Admin_id
   conn.execute(sql)
   case "forbid"
   call CheckNum(Admin_id)
   sql="update Admins set Admin_state=0 where Admin_id="&Admin_id
   conn.execute(sql)
end select
%>
   <table cellSpacing="0" cellPadding="0" width="740" border="0" class="table">
<%
dim page_size,rscount,item_count,page_num,page_now,i
page_size=10
set rscount=conn.execute("select count(*) as item_count from Admins")
	item_count=cint(rscount("item_count"))
	rscount.close
    page_num=item_count\page_size 
sql="select * from Admins order by Admin_id desc"
rs.CursorLocation = 3
rs.open sql,conn,1,3
if not rs.eof then
	rs.pagesize=page_size
	page_now=1
	if trim(request.QueryString("page"))<>"" then
	page_now=cint(trim(request.QueryString("page")))
	end if
	if page_now>rs.pagecount or page_now<0 then
	page_now=1
	end if
	rs.absolutepage=page_now
%>
  <tr>
    <th width="97">用户名</th>
    <th width="116">真实姓名</th>
    <th width="106">超级管理员</th>
    <th width="139">管理员E-mail</th>
    <th width="128">最后登入</th>
    <th width="117">登入次数</th>
    <th width="107">添加日期</th>
    <th width="165">操作</th>
  </tr>
<%
  i=1
  while not rs.eof and i<page_size+1
%>
  <tr>
    <td><%=rs("Admin_user")%></td>
    <td><%=rs("Admin_name")%></td>
    <td><%SwitchBoolean(rs("Admin_state"))%></td>
    <td><%=rs("Admin_email")%></td>
    <td title="<%=rs("Admin_logintime")%>"><%=getDate(rs("Admin_logintime"))%></td>
    <td><%=rs("Admin_logintimes")%></td>
    <td title="<%=rs("Admin_addtime")%>"><%=getDate(rs("Admin_addtime"))%></td>
    <td>
	<a href="AdminEdit.asp?Admin_id=<%=rs("Admin_id")%>">编辑</a>&nbsp;|<%if rs("Admin_state")=1 then%>
    <a href="?Action=forbid&Admin_id=<%=rs("Admin_id")%>">降级</a>
    <%else%>
    <a href="?Action=audi&Admin_id=<%=rs("Admin_id")%>">升级</a>
    <%end if%>
	|<a href="#"onclick="javascript:if (confirm('确认删除&nbsp;?')) href='AdminDel.asp?Admin_id=<%=rs("Admin_id")%>';else return;">删除</a>	</td>
  </tr>
<%
   rs.movenext
   i=i+1
   wend
%>
  <tr>
    <td colspan="8" align="right">
<div id="bottom_pagebox" style="padding-right:40px;">
当前第<%=page_now%>页
  <%if page_now=1 then%>首页
  <%else%><a href="AdminList.asp?page=1">首页</a>
  <%end if%>
  <%if page_now>1 and rs.pagecount>1 then%>
  <a href="AdminList.asp?page=<%=page_now-1%>">上一页</a>
  <%else%>上一页
  <%end if%>				
  <%if page_now<rs.pagecount then%> 
  <a href="AdminList.asp?page=<%=page_now+1%>">下一页</a>
  <%else%>下一页
  <%end if%>				
  <%if page_now<>rs.pagecount then%> 
  <a href="AdminList.asp?page=<%=rs.pagecount%>">尾页</a>
  <%else%>尾页
  <%end if%>
  共<%=rs.pagecount%>页/<%=item_count%>个</div>
	</td>
  </tr>
<%end if%>
<%rs.close%>
</table>
   
